#include <cstdio>
#include <cstring>

	int n;
	int m;
	int sum;
	int Ncase, ct;

using namespace std;

int main()
{
	int i, k;
	
	//freopen("e.in", "r",stdin);
	//freopen("e.out", "w",stdout);
	
	scanf("%ld", &Ncase);
	for (ct=1; ct<=Ncase; ct++)
	{
		sum = 0;
		scanf("%ld", &m);
		for (i=1; i<=m; i++)
		{
			scanf("%ld", &k);
			sum += k;
		}
		sum -= m-1;
		printf("%ld\n", sum);
	}
	return 0;
}

